package edu.hut;

/**
 * 主函数
 *
 * @author GuoQian
 * @since 2024-11-14
 * @version 1.0
 */
public class Main {
    /**
     * 程序的主入口方法，在这里创建各种几何图形的实例，并对它们进行一系列操作，
     * 包括绘制图形、检查图形是否可形成以及计算图形的面积。
     *
     * @param args 命令行参数，在本示例中未实际使用。
     */
    public static void main(String[] args) {
        Vertex v1 = new Vertex();
        v1.x = 0;
        v1.y = 0;
        Vertex v2 = new Vertex();
        v2.x = 1;
        v2.y = 1;
        Vertex v3 = new Vertex();
        v3.x = 4;
        v3.y = 4;
        Vertex v4 = new Vertex();
        v4.x = 3;
        v4.y = 1;

        Triangle triangle = new Triangle(v1, v2, v3);
        triangle.draw();
        System.out.println("Triangle can form: " + triangle.canForm());
        System.out.println("Triangle area: " + triangle.calcArea());


        Rectangle rectangle = new Rectangle(v1,v2,v3,v4);
        rectangle.draw();
        System.out.println("Rectangle can form: " + rectangle.canForm());
        System.out.println("Rectangle area: " + rectangle.calcArea());

        Circle circle = new Circle(5);
        AdapterCircle adapterCircle = new AdapterCircle(circle);
        adapterCircle.draw();
        System.out.println("Circle can form: " + adapterCircle.canForm());
        System.out.println("Circle area: " + adapterCircle.calcArea());
    }
}
